
// #ifndef VUE3
import Vue from 'vue'
import App from './App'
import axios from 'axios'

Vue.config.productionTip = false
Vue.prototype.$axios = axios

App.mpType = 'app'

// 自定义适配器，支持携带cookie
axios.defaults.adapter = function(config) {
	return new Promise((resolve, reject) => {
		console.log(config)
		var settle = require('axios/lib/core/settle');
		var buildURL = require('axios/lib/helpers/buildURL');
		uni.request({
			method: config.method.toUpperCase(),
			url: config.baseURL + buildURL(config.url, config.params, config.paramsSerializer),
			header: config.headers,
			data: config.data,
			dataType: config.dataType,
			responseType: config.responseType,
			sslVerify: config.sslVerify,
			complete: function complete(response) {
				console.log('执行完成：',response)
				response = {
				data: response.data,
				status: response.statusCode,
				errMsg: response.errMsg,
				header: response.header,
				config: config
				};
				settle(resolve, reject, response);
			}
		})
	})
}
 
const app = new Vue({
    ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import App from './App.vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif
// main.js，注意要在use方法之后执行

import uView from "@/uni_modules/uview-ui";
Vue.use(uView);
